/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package podologia.beansDB;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Hernan
 */
@Entity
@Table(name = "permisoxempleado")
@NamedQueries({@NamedQuery(name = "Permisoxempleado.findAll", query = "SELECT p FROM Permisoxempleado p"), @NamedQuery(name = "Permisoxempleado.findByIdpermisoxemp", query = "SELECT p FROM Permisoxempleado p WHERE p.idpermisoxemp = :idpermisoxemp")})
public class Permisoxempleado implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Basic(optional = false)
    @Column(name = "idpermisoxemp")
    private Integer idpermisoxemp;
    @JoinColumn(name = "idPermiso", referencedColumnName = "idPermiso")
    @ManyToOne(optional = false)
    private Permiso idPermiso;
    @JoinColumn(name = "legajo", referencedColumnName = "legajo")
    @ManyToOne(optional = false)
    private Empleado legajo;

    public Permisoxempleado() {
    }

    public Permisoxempleado(Integer idpermisoxemp) {
        this.idpermisoxemp = idpermisoxemp;
    }

    public Integer getIdpermisoxemp() {
        return idpermisoxemp;
    }

    public void setIdpermisoxemp(Integer idpermisoxemp) {
        this.idpermisoxemp = idpermisoxemp;
    }

    public Permiso getIdPermiso() {
        return idPermiso;
    }

    public void setIdPermiso(Permiso idPermiso) {
        this.idPermiso = idPermiso;
    }

    public Empleado getLegajo() {
        return legajo;
    }

    public void setLegajo(Empleado legajo) {
        this.legajo = legajo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idpermisoxemp != null ? idpermisoxemp.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Permisoxempleado)) {
            return false;
        }
        Permisoxempleado other = (Permisoxempleado) object;
        if ((this.idpermisoxemp == null && other.idpermisoxemp != null) || (this.idpermisoxemp != null && !this.idpermisoxemp.equals(other.idpermisoxemp))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "javaapplication2.Permisoxempleado[idpermisoxemp=" + idpermisoxemp + "]";
    }

}
